
<script type="text/javascript">
$(document).ready(function(){ldelim}



	$('form').submit(function() {ldelim}
		CKupdate();	
		var url = $(this).attr('action');
		var data = $(this).serialize();	
		if ($('#id_cat').val() == ''){ldelim}
			execute('', '', 'Товар успешно добавлен', url, '', data, function(){ldelim}updateHash('tab4-2tab'); setupHash('widget2');{rdelim});
		{rdelim}else{ldelim}
			execute('', '', 'Товар успешно отредактирован', url, '', data, function(){ldelim}updateHash('tab4-2tab'); setupHash('widget2');{rdelim});
		{rdelim}
		return false;
	{rdelim});


	$('#product_published_start').datetimepicker({ldelim}
		timeOnlyTitle: 'Выберите время',
		timeText: 'Время',
		hourText: 'Часы',
		minuteText: 'Минуты',
		secondText: 'Секунды',
		currentText: 'Теперь',
		closeText: 'Закрыть'
	{rdelim});
{rdelim});
</script>


<br/>
<h4 class="pagetitle">Добавить новый товар</h4>
<br/>

<form action="index.php?do=modules&action=modedit&mod=shop&moduleaction=edit_product&cp={$sess}&pop=1&Id={$smarty.request.Id}&sub=save" method="post" class="mainForm">
	<input type="hidden" value="{$row.Id}" name="id_cat" id="id_cat">	
	<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
		<tr>
			<td width="190">{#ProductDActive#} </td>
			<td>
				<input name="product_active" type="checkbox" id="product_active" value="1" {if $row.product_active=='1'}checked="checked" {/if}/>
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductName#}</td>
			<td>
				<div class="pr12"><input name="product_name" type="text" id="product_name" style="width:100%" value="{$row.product_name|stripslashes|escape}" /></div>
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductNrS#}&nbsp;<a href="javascript:void(0);" class="topleftDir" title="{#ProductNewAllowedChars#}">[?]</a></td>
			<td>
				<div class="pr12"><input name="product_article" type="text" id="product_article" style="width:100%" value="{$row.product_article|stripslashes}" /></div>

				<input name="product_article_old" type="hidden" id="product_article_old" value="{$row.product_article|stripslashes}" />

			</td>
		</tr>
		<tr>
			<td width="190">{#ProductPublished#}
				&nbsp;<a title="{#ProductPublishedInf#}" class="topleftDir" href="javascript:void(0);">[?]</a>
			</td>
			<td>
				<input id="product_published_start" name="product_published_start" type="text" value="{$row.product_published_start|date_format:"%d.%m.%Y %H:%M"}" style="width: 150px;" />
			</td>
		</tr>
	
		<tr>
			<td width="190">Распродажа</td>
			<td>
				<input name="product_sel" type="checkbox" id="product_sel" value="1" {if $row.product_sel=='1'}checked="checked" {/if}/>
			</td>
		</tr>
		<tr>
		<td width="190">Лидер продаж</td>
			<td>
				<input name="product_top" type="checkbox" id="product_top" value="1" {if $row.product_top=='1'}checked="checked" {/if}/>
			</td>
		</tr>
		<tr>
		<td width="190">Новинка</td>
			<td>
				<input name="product_new" type="checkbox" id="product_new" value="1" {if $row.product_new=='1'}checked="checked" {/if}/>  
			</td>
		</tr>
	</table>	
<br/>	
<div class="topleftDir head {if $row.Id}closed{/if}" title="нажмите что бы развернуть или свернуть" style="border-top:1px solid #D5D5D5;"><h5>Изображения</h5></div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">		
		<tr>
			<td width="190">{#ProductImage#}</td>
			<td>
			<div class="pr12">
				<a href="{$row.product_image}" target="_blank"><img border='0' align='left' alt='' width="120" id="preview__product_image" src='{$row.product_image_thumb}' style='padding: 2px 2px 0pt 0px;'></a>
				<div class="clear" style="height:5px"></div>
				<input style="width:50%" name="product_image" type="text" id="product_image" value="{$row.product_image|escape}" /> 
				<input value="выбрать" class="basicBtn topDir" onclick="openFileWindow('product_image','product_image');" type="button">
			</div>	
			</td>
		</tr>
		<tr>
			<td width="190">{#ProductMultiImages#}<br><small>{#ProductMultiImagesInf#}</small></td>
			<td><div class="pr12">{$product_category_multi_parse}</div></td>
		</tr>
</table>
<br/>	
<div class="topleftDir head {if $row.Id}closed{/if}" title="нажмите что бы развернуть или свернуть" style="border-top:1px solid #D5D5D5;"><h5>Описания</h5></div>		
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
		<tr>
			<td width="190">{#ProductTs#}</td>
			<td>{$product_small_description}</td>
		</tr>

		<tr>
			<td width="190">{#ProductTl#}</td>
			<td>{$product_description}</td>
		</tr>
</table>		
<br/>

<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
		<tr>
			<td width="190">{#ProductCateg#}</td>
			<td>
				<select style="width:250px" name="product_category" id="product_category">
					{foreach from=$ProductCategs item=pc}
						
						<option value="{$pc->Id}" {if $pc->Id==$row.product_category} selected="selected"{/if}>{$pc->expander}{$pc->category_name|escape:html|stripslashes}</option>
					{/foreach}
				</select>
			</td>
		</tr>

		<tr>
			<td width="190">
				{#ProductCategMulti#}&nbsp;
				<a title="{#ProductCategMultiInf#}" class="topleftDir" href="javascript:void(0);">[?]</a>
			</td>
			<td>
				<select name="product_category_multi[]" multiple="multiple" size="6" style="width:250px; padding:0 0 0 10px">
					{foreach from=$ProductCategs item=pc}
						{assign var='sel' value=''}
						{if $pc->Id}
							{if (in_array($pc->Id,$row.product_category_multi))}
								{assign var='sel' value='selected'}
							{/if}
						{/if}
						<option value="{$pc->Id}" {$sel}>{$pc->expander}{$pc->category_name|escape:html|stripslashes}</option>
					{/foreach}
				</select>				
			</td>
		</tr>

		
		

		<tr>
			<td width="190">
				{#ProductMatchwords#}
				&nbsp;<a title="{#ProductMatchwordsInf#}" class="topleftDir" href="javascript:void(0);">[?]</a>
			</td>
			<td>
				<div class="pr12"><input name="product_related" type="text" id="product_related" style="width:100%" value="{$row.product_related|stripslashes}" /></div>
			</td>
		</tr>

		<tr>
			<td width="190">Ключевые слова<br/><small>(meta keywords)</small></td>
			<td>
				<div class="pr12"><input name="ProdKeywords" type="text" id="ProdKeywords" size="40" value="{$row.ProdKeywords|stripslashes}" style="width:100%" /></div>
			</td>
		</tr>

		<tr>
			<td width="190">Описание страницы:<br/><small>(meta description)</small></td>
			<td>
			<div class="pr12"><input name="ProdDescription" type="text" id="ProdDescription" size="40" style="width:100%" value="{$row.ProdDescription|stripslashes}" maxlength="170" /></div>
			</td>
		</tr>
{*
		<tr>
			<td width="190">bid</td>
			<td>
				<input name="bid" type="text" value="{$row.bid}" size="10" maxlength="5" />
			</td>
		</tr>

		<tr>
			<td width="190">cbid</td>
			<td>
				<input name="cbid" type="text" value="{$row.cbid}" size="10" maxlength="5" />
			</td>
		</tr>
*}
		<tr>
			<td width="190">{#ProductManufacturer#}</td>
			<td>
				<select name="product_manufacturer" style="width:250px">
					<option value="0">{#ProductManufacturerNo#}</option>
						{foreach from=$Manufacturer item=m}
							<option value="{$m->Id}" {if $row.product_manufacturer==$m->Id}selected="selected"{/if}>{$m->manufacturer_name|stripslashes}</option>
						{/foreach}
				</select>
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductVatZone#}</td>
			<td>
				<select name="UstZone" id="UstZone" style="width:250px">
					{foreach from=$VatZones item=vz}
						<option value="{$vz->Id}" {if $row.UstZone==$vz->Id}selected="selected"{/if}>{$vz->Name} ({$vz->Wert})</option>
					{/foreach}
				</select>
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductPrice#}&nbsp;<a title="{#ProductPriceInf#}" class="topleftDir" href="javascript:void(0);">[?]</a></td>
			<td>
				<input name="product_price" type="text" id="product_price" style="width:100px" maxlength="10" value="{$row.product_price}" />
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductList#} &nbsp;<a title="{#ProductListInf#}" class="topleftDir" href="javascript:void(0);">[?]</a></td>
			<td>
				<input name="product_price_old" type="text" id="product_price_old" style="width:100px" maxlength="10" value="{if $row.product_price_old > 0}{$row.product_price_old}{/if}" />
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductWeight#}</td>
			<td>
				<input name="product_weight" type="text" id="product_weight" style="width:100px" value="{if $row.product_weight > 0}{$row.product_weight}{/if}" />&nbsp;
				{#ProductWeightInf#}
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductUnits#}
				&nbsp;<a title="{#ProductUnitsInf#}" class="topleftDir" href="javascript:void(0);">[?]</a>
			</td>
			<td>
				<input name="Einheit" type="text" id="Einheit" style="width:100px" value="{if $row.Einheit > 0}{$row.Einheit}{/if}" />
				/ <select name="EinheitId" id="EinheitId">
					<option value=""></option>
					{foreach from=$Units item=unit}
						<option value="{$unit->Id}" {if $row.EinheitId==$unit->Id}selected="selected"{/if}>{$unit->Name|stripslashes}</option>
					{/foreach}
				</select>
			</td>
		</tr>

		<tr>
			<td width="190">{#ProductStored#}</td>
			<td>
				<input name="product_warehouse" type="text" id="product_warehouse" style="width:100px" value="{$row.product_warehouse}" />
			</td>
		</tr>

		<tr>
			<td width="190">Гарантия</td>
			<td>
				<select name="VersandZeitId" style="width:250px">
					<option value="0"></option>
					{foreach from=$ShippingTime item=st}
						<option value="{$st->Id}" {if $row.VersandZeitId==$st->Id}selected="selected"{/if}>{$st->Name|stripslashes}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td width="190">
				<input accesskey="s" class="basicBtn topDir" type="submit" value="{#ButtonSave#}" />
			</td>
			<td>
				&nbsp;
			</td>
		</tr>
</table>
<br />



<div class="topleftDir head closed" title="нажмите что бы развернуть или свернуть"><h5>Дополнительные поля</h5></div>

<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic">
		<tr>
			<td width="190">Заголовок поля 1</td>
			<td>
				<input name="product_dop_title_1" type="text" id="product_dop_title_1" style="width:100%" value="{$row.product_dop_title_1|stripslashes}" />
			</td>
		</tr>

		<tr>
			<td width="190">Содержание поля 1</td>
			<td>{$product_dop_text_1}	</td>
		</tr>

		<tr>
			<td width="190">Заголовок поля 2</td>
			<td>
				<input name="product_dop_title_2" type="text" id="product_dop_title_2" style="width:100%" value="{$row.product_dop_title_2|stripslashes}" />
			</td>
		</tr>

		<tr>
			<td width="190">Содержание поля 2</td>
			<td>{$product_dop_text_2}	</td>
		</tr>

		<tr>
			<td width="190">Заголовок поля 3</td>
			<td>
				<input name="product_dop_title_3" type="text" id="product_dop_title_3" style="width:100%" value="{$row.product_dop_title_3|stripslashes}" />
			</td>
		</tr>

		<tr>
			<td width="190">Содержание поля 3</td>
			<td>{$product_dop_text_3}	</td>
		</tr>

		<tr>
			<td width="190">Заголовок поля 4</td>
			<td>
				<input name="product_dop_title_4" type="text" id="product_dop_title_4" style="width:100%" value="{$row.product_dop_title_4|stripslashes}" />
			</td>
		</tr>

		<tr>
			<td width="190">Содержание поля 4</td>
			<td>{$product_dop_text_4}	</td>
		</tr>

		<tr>
			<td width="190">
				<input accesskey="s" class="basicBtn topDir" type="submit" value="{#ButtonSave#}" />
			</td>
			<td>
				&nbsp;
			</td>
		</tr>
	</table>
	<br/>
</form>